ImageGear improves the overall size of saved PDF documents by reducing or removing data structures in a PDF document.
File size improvements will vary with each PDF file. In some cases, file size reduction is dramatic. By default, ImageGear removes standard fonts embedded in a PDF document for additional compression benefits. Re-saving an optimized PDF file is not expected to further reduce its size. In rare instances, PDF file size may increase due to metadata that is always written when PDF documents are saved.
To compress a PDF document using ImageGear:
The following is a sample function that illustrates how to save a highly-compressed PDF to disk:
C and C++ |
Copy Code
|
---|---|
void SaveCompressedPDF(LPSTR lpInputFile, LPSTR lpOutputFile)
{
HMIGEAR pdfDocument;
IG_mpi_create(&pdfDocument, 0);
IG_mpi_file_open(lpInputFile, pdfDocument, IG_FORMAT_PDF, IG_MP_OPENMODE_READONLY);
AT_ERRCOUNT nErr = IG_PDF_save_compressed(pdfDocument, lpOutputFile);
IG_mpi_delete(pdfDocument);
}
|
Refer to the sample SaveCompressedPDF for a more complete example of re-saving PDF files (see PDF Samples).